Added support for pins_with_function!() and pin_with_name!()#963
Open
MarkSwanson wants to merge 1 commit intorp-rs:mainfrom
Open
Added support for pins_with_function!() and pin_with_name!()#963MarkSwanson wants to merge 1 commit intorp-rs:mainfrom
MarkSwanson wants to merge 1 commit intorp-rs:mainfrom
Conversation
pub static PICOTOOL_ENTRIES: [rp_binary_info::EntryAddr; 7] = [
rp_binary_info::pins_with_function!(
PICO_DEFAULT_I2C_SDA_PIN,
PICO_DEFAULT_I2C_SCL_PIN,
GPIO_FUNC_I2C),
rp_binary_info::pin_with_name!(
25, // pin 25 is the LED
c"The LED"
),
];
I found constants in these places:
pico-sdk/src/boards/include/boards/pico2_w.h
pico-sdk/src/common/pico_binary_info/include/pico/binary_info/structure.h
pico-sdk/src/rp2350/hardware_structs/include/hardware/structs/io_bank0.h
Member
|
Can you reformat and squash? |
thejpster
reviewed
Sep 25, 2025
| data_type: DataType::PinsWithFunction, | ||
| tag: TAG_RASPBERRY_PI, | ||
| }, | ||
| pin_encoding: BI_PINS_ENCODING_MULTI |
Member
There was a problem hiding this comment.
I think it's worth noting that this is a value with multiple fields, and raspberry pi seem to indicate that there are no more pins by setting two consecutive fields to the same value.
You could also consider using bitbybit::bitfield to describe this 32-bit value, and avoid needing to do a bunch of shifts using magic numbers. I have examples you can refer to
Member
There was a problem hiding this comment.
You could then change this to take a slice of pins, rather than only two pins.
thejpster
reviewed
Sep 25, 2025
| /// GPIO pins, with their function | ||
| PinsWithFunction = 8, | ||
| /// GPIO pins, with their name | ||
| /// GPIO pins, with their name pico-sdk: BINARY_INFO_TYPE_PINS_WITH_NAME |
Member
There was a problem hiding this comment.
Suggested change
| /// GPIO pins, with their name pico-sdk: BINARY_INFO_TYPE_PINS_WITH_NAME | |
| /// GPIO pins, with their name | |
| /// | |
| /// The Pico SDK calls this `BINARY_INFO_TYPE_PINS_WITH_NAME` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I submitted this to be used as a reference to save someone some time for when they decide to do a full implementation.
I found constants in these places:
pico-sdk/src/boards/include/boards/pico2_w.hpico-sdk/src/common/pico_binary_info/include/pico/binary_info/structure.hpico-sdk/src/rp2350/hardware_structs/include/hardware/structs/io_bank0.h